<template>
  <div>
    <bannerComponent></bannerComponent>
    <classification :newbox1="newlist9"></classification>

    <projectOne :learnbox="newlist10" @changeproduct="changeproduct" :product="product1" :productdata="simuguquan"></projectOne>
    <projectOne :learnbox="newlist10" @changeproduct="changeproduct" :product="product2" :productdata="jihexintuo"></projectOne>
    <projectOne :learnbox="newlist10" @changeproduct="changeproduct" :product="product3" :productdata="qiyuejijin"></projectOne>
    <div class="maincontent">
      <div class="add">
        <nuxt-link to="/product/37">
          <img src="http://p6dwecco6.bkt.clouddn.com/img/add2.png" alt="">
        </nuxt-link>
      </div>
    </div>
    <announcement2 :infodata="newlist7" :newbox1="newlist1" :newbox2="newlist2" :newbox3="newlist3" :newbox4="newlist11"></announcement2>
      <announcement :infodata="newsinfo2" :newbox1="newlist4" :newbox2="newlist5" :newbox3="newlist6"></announcement>
      <announcement3 :infodata="product4" :newbox1="newlist8"></announcement3>
      <gonggao :newbox="newlist12"></gonggao>
    <firend></firend>
    <!-- <FinancialComponent></FinancialComponent> -->
  </div>
</template>
<script>

import asyncApi from '../../static/js/asyncApi.js';
import api from '../../static/js/api.js';
import bannerComponent from "../../components/bannerComponent";
import classification from "../../components/classification";
import projectOne from "../../components/projectOne";
import firend from "../../components/firend";
import siMuGuQuan from "../../components/siMuGuQuan";
import FinancialComponent from "../../components/FinancialComponent";
import announcement from "../../components/announcement";
import announcement2 from "../../components/announcement2";
import announcement3 from "../../components/announcement3";
import gonggao from "../../components/gonggao";


export default {
  data(){
    return{
      product1:{
        productBack:"http://p6dwecco6.bkt.clouddn.com/img/productBack2.jpg",
        index:0,
        title:"PE",
        content1:"PE产品精选",
        p1:"焦距成长，凝练价值",
        p2:"华丽转身，涨幅惊人",
        number1:0,
        number2:3,
        more:"更多PE投资策略",
        morelink:"/equity",
        show1:"同类项目盈利高达600%",
        show2:"超强管理人团队",
        fenlei1:"Pro-IPO",
        fenlei2:"PE/VC",
        fenlei3:"",
        fenlei4:"FOF",
        fenlei5:"其他"
      },
      product2:{
        productBack:"http://p6dwecco6.bkt.clouddn.com/img/productBack3.jpg",
        index:1,
        title:"信托资管",
        content1:"信托资管产品精选",
        p1:"稳健固收",
        p2:"价值首选",
        p3:"和时间成为朋友",
        number1:4,
        number2:7,
        more:"更多信托资管投资策略",
        morelink:"/trust",
        show1:"稀缺直辖市底层资产信托",
        show2:"土地抵押担保",
        fenlei1:"房地产",
        fenlei2:"金融投资",
        fenlei3:"工商企业流贷",
        fenlei4:"政信",
        fenlei5:"其他"
      },
      product3:{
        productBack:"http://p6dwecco6.bkt.clouddn.com/img/productBack4.jpg",
        index:2,
        title:"契约基金",
        content1:"契约基金产品精选",
        p1:"稳固保障",
        p2:"放心投资",
        p3:"打好资产配置根基",
        number1:8,
        number2:10,
        more:"更多信托资管投资策略",
        morelink:"/fund",
        show1:"足额担保，金融机构跟投",
        show2:"市场稀缺，政府政信项目",
        show1:"稀缺直辖市底层资产信托",
        show2:"土地抵押担保",
        fenlei1:"房地产",
        fenlei2:"金融投资",
        fenlei3:"工商企业流贷",
        fenlei4:"政信",
        fenlei5:"其他"
      },
      product4:{
        productBack:"http://p6dwecco6.bkt.clouddn.com/img/productBack4.jpg",
        index:2,
        title:"天沁荣誉",
        content1:"",
        p1:"",
        p2:"",
        p3:"",
        show1:"足额担保，金融机构跟投",
        show2:"市场稀缺，政府政信项目"
      },
      newsinfo2:{
        title:"热点资讯",
        detail1:"宏观新闻",
        detail2:"财经新闻",
        detail3:"市场新闻",
        url1:"/column/hongguanxinwen",
        url2:"/column/caijingxinwen",
        url3:"/column/shichangxinwen"                
      }
    }
  },
  methods:{
     changeproduct(data){
       if(data.title == "PE"){
          api.getProduct({categoryName:"私募股权",investDirection:data.val,pageSize:2,orderBy:"weigh",orderByType:"desc"}).then((res)=>{
              this.simuguquan = res.data.list
          })
       }else if(data.title == "信托资管"){
          api.getProduct({categoryName:"信托资管",investDirect:data.val,pageSize:2,orderBy:"weigh",orderByType:"desc"}).then((res)=>{
              this.jihexintuo = res.data.list
          })
       }else if(data.title == "契约基金"){
          api.getProduct({categoryName:"契约基金",investDirect:data.val,pageSize:2,orderBy:"weigh",orderByType:"desc"}).then((res)=>{
              this.qiyuejijin = res.data.list
          })
       }
    }
  },
  components: {
    bannerComponent,
    classification,
    projectOne,
    siMuGuQuan,
    FinancialComponent,
    announcement,
    announcement2,
    announcement3,
    gonggao,
    firend
  },
  async asyncData () {
    let [data1,data2,data3,new1,new2,new3,new4,new5,new6,new7,new8,new9,new10,new11,new12] = await Promise.all([
        asyncApi.asyncgetProduct({categoryName:"私募股权",orderBy:"weigh",orderByType:"desc"}),
        asyncApi.asyncgetProduct({categoryName:"信托资管",orderBy:"weigh",orderByType:"desc"}),
        asyncApi.asyncgetProduct({categoryName:"契约基金",orderBy:"weigh",orderByType:"desc"}),

        asyncApi.asyncgetTagPost({tagName:"股权",page:"1",pageSize:"3"}),
        asyncApi.asyncgetTagPost({tagName:"信托",page:"1",pageSize:"3"}),
        asyncApi.asyncgetTagPost({tagName:"基金",page:"1",pageSize:"3"}),

        asyncApi.asyncgetTagPost({tagName:"宏观",page:"1",pageSize:"5"}),
        asyncApi.asyncgetTagPost({tagName:"财经",page:"1",pageSize:"5"}),
        asyncApi.asyncgetTagPost({tagName:"政策",page:"1",pageSize:"5"}),

        asyncApi.asyncGetCategoryPost({categoryName:"投资策略",page:"1",pageSize:"10"}),
        asyncApi.asyncGetCategoryPost({categoryName:"天沁新闻",page:"1",pageSize:"5"}),

        asyncApi.asyncgetTagPost({tagName:"公告",page:"1",pageSize:"9"}),

        asyncApi.asyncGetCategoryPost({categoryName:"投资学堂",page:"1",pageSize:"11",orderBy:"weigh",orderByType:"desc"}),
        asyncApi.asyncGetCategoryPost({categoryName:"投资策略",page:"1",pageSize:"2",orderBy:"weigh",orderByType:"desc"}),
        asyncApi.asyncGetCategoryPost({categoryName:"产品公告",page:"1",pageSize:"10",orderBy:"weigh",orderByType:"desc"}),
        
    ])
    return {
    simuguquan:data1.data.data.list,
    jihexintuo:data2.data.data.list,
    qiyuejijin:data3.data.data.list,

    newlist1:new1.data.data.list,
    newlist2:new2.data.data.list,
    newlist3:new3.data.data.list,
    newlist4:new4.data.data.list,
    newlist5:new5.data.data.list,
    newlist6:new6.data.data.list,

    newlist7:new7.data.data.list,
    newlist8:new8.data.data.list,
    newlist9:new9.data.data.list,
    newlist10:new10.data.data.list,
    newlist11:new11.data.data.list,
    newlist12:new12.data.data.list

    }
   },
   beforeCreate:function(){
     this.$store.state.breadcrumbs = []
     this.$store.state.breadcrumbs[0] =  {name:"首页",url:"/"}
  }
};
</script>

<style scoped>

.maincontent{
  width: 100%;
  margin-top: 20px;
}
.add{
  margin: 20px 0 20px;
  width: 100%;
  text-align: center;
}
.add img{
  width: 1200px;
}
</style>
